<template>
  <div>
    <!-- 选择部门 -->
    <div class="one">
      <van-field label="选择所在部门" v-model="from.Deptname" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="openshowDept" required :error="rule.myDept"/>
      <!-- 弹层 -->
      <van-popup v-model="showmyDept" position="bottom">
        <van-picker show-toolbar :columns="columnsdata" @cancel="showmyDept = false" @confirm="Deptnameconfirm"/>
      </van-popup>
    </div>

    <!-- 选择主办单位 -->
    <div class="one">
      <van-field label="主办单位(Organisateur (Service/Projet))" v-model="from.organizers" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="showPicker = true" required :error="rule.organizers"/>
      <!-- 弹层 -->
      <van-popup v-model="showPicker" position="bottom">
        <van-picker show-toolbar :columns="organizers" @cancel="showPicker = false" @confirm="onConfirm"/>
      </van-popup>
    </div>
     <!-- 联系人 -->
    <div class="one">
      <van-field label="联系人及联系方式(Contact et ses coordonnées)" v-model="from.contactsName" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="contactsPerson('contactsName')" required :error="rule.contacts"/>
    </div>

    <!-- 出差事由 -->
    <div class="one">
      <van-field type="textarea" v-model="from.reason" rows=3 label="出差事由(Motif de déplacement)" placeholder="请输入" clearable autosize required :error="rule.reason" @focus="rule.reason = false"></van-field>
    </div>

    <!-- 出差职员 -->
    <div class="one" v-for="(item, index) in from.personID"  :key="'info1-'+ index">
      <div class="person_title" >
        <span style="margin-left:18px; padding-bottom:15px">同行人明细 ({{index+1}})</span>
        <span style="margin-right:18px; color:#1989FA" @click="delPerson(index)" v-if="index != 0">删除</span>
      </div>

      <van-field label="出差职员(中文+外文/拼音)" v-model="item.name" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="contactsPerson('name', index)"/>

      <div class="add" @click="addPerson" style="background:#fff" v-if="index === from.personID.length-1">
        <van-icon name="plus" style="font-size:16px"/>
        <span style="font-size:16px;">增加明细</span>
      </div>
    </div>

    <!-- 出差时间 -->
    <div class="one">
      <div class="person_title" >
        <span style="margin-left:18px; padding-bottom:15px">出差时间(Dates de déplacement)</span>
      </div>
      <van-field label="出差开始时间" v-model="from.startDate" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="startDateshow('start')" :error="rule.startDate" required />
      <van-field label="出差结束时间" v-model="from.endDate" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="endDateshow('end')"  :error="rule.endDate" required/>
      <van-field label="共计时长(天)" v-model="from.days" input-align="right" clearable right-icon="arrow" disabled />
    </div> 

    <!-- 日期时间选择 弹窗-->
    <div class="popup-container"> 
      <van-popup v-model = "showDate" position="bottom">
        <van-datetime-picker v-model="startDate1" type="date" @cancel="showDate=false" @confirm="startConfirm" />
      </van-popup>
    </div>

    <!-- 出差行程及航班 -->
    <div class="one" v-for="(item, index) in from.flight" :key="'info-'+ index">
      <div class="person_title" >
        <span style="margin-left:18px; padding-bottom:15px">出差行程及航班信息(Programme de déplacement et informations de vol) ({{index+1}})</span>
        <span style="margin-right:18px; color:#1989FA" @click="delFlight(index)" v-if="index != 0">删除</span>
      </div>
      <van-field label="出差目的地(Destination de déplacement)" v-model="item.destination" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="flyaddre(index, 'ChuCaiMuDiDi')" :error="rule.destination" required/>

      <van-field label="行程日期" v-model="item.goTime" placeholder="请选择 " input-align="right" clearable right-icon="arrow" disabled @click="showgot(index)"/>
      <div class="sd">
        <div style="font-size:15px;margin-left:20px"><span style="color:red">*</span>选择天数</div>
        <van-stepper title="天数" v-model="item.numday" style="margin-right:20px" :integer="true" @change="hahah"/>
      </div>
      <div class="popup-container">
        <van-popup v-model = "goTimeshow" position="bottom">
          <van-datetime-picker v-model="endDate1" type="date" @cancel="goTimeshow = false" @confirm="goTimeConfirm" />
        </van-popup>
      </div>
      <van-field label="航班号" v-model="item.filghtNumber" placeholder="请输入     " input-align="right"/>
      <van-field label="起飞地" v-model="item.takeoff" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled  @click="flyaddre(index, 'qifei')" :error="rule.takeoff" required/>

      <van-field label="到达地" v-model="item.arrive" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="flyaddre(index, 'daoda')" :error="rule.arrive" required/>

      <!-- 起飞/到达 地弹窗 -->
      <div class="popup-container">
        <van-popup v-model = "flyaddreshow" position="bottom">
          <van-area :area-list="areaList" :columns-num="2" title="选择市" @cancel="flyaddreshow = false" @confirm="flyaddreConfirm"/>
        </van-popup>
      </div>

      <van-field label="起飞时间" v-model="item.takeoffTime" placeholder="请选择" input-align="right" clearable right-icon="arrow" disabled @click="flyTime(index,'qifeiTime')"/>
      <van-field label="到达时间" v-model="item.arriveTime" placeholder="请选择" input-align="right" clearable right-icon="arrow"  disabled @click="daoTime(index, 'daodaTime')"/>

      <!-- 开始/到达时间日期弹窗 -->
      <div class="popup-container">
        <van-popup v-model = "arrivetime" position="bottom">
          <van-datetime-picker v-model="endDate1" type="datetime" @cancel="arrivetime = false" @confirm="arriveTimeConfirm" />
        </van-popup>
      </div>

      <div class="add" @click="addFlight" style="background:#fff" v-if="index === from.flight.length - 1">
        <van-icon name="plus" style="font-size:16px"/>
        <span style="font-size:16px;">增加明细</span>
      </div>
    </div>
    
    <!-- 费用部分 -->
    <div class="one">
      <div class="person_title" >
        <span style="margin-left:18px; padding-bottom:15px">差旅费用预算(Budget de déplacement)</span>
      </div>
      <van-field label="长途交通费用/(欧元)(Frais de transport à longue distance)" type="number" v-model="from.traffic" placeholder="请输入金额   " clearable input-align="right"  @input="totalMoney1" @clear="from.traffic=''"/>
    </div>

    <div class="one">
      <van-field label="住宿费用/(欧元)(Frais d’hébergement)" type="number" v-model="from.accommodation" placeholder="请输入金额   " input-align="right" disabled @input="totalMoney2"/>
    </div>
    <div class="one">
      <van-field label="伙食费用/出差补助/(欧元)(Frais de nourriture)" type="number" v-model="from.subsidy" placeholder="请输入金额   " input-align="right" disabled @input="totalMoney3"/>
    </div>

    <div class="one">
      <van-field label="市政交通费用/(欧元)(Frais de transport municipal)" type="number" v-model="from.cityMoney" placeholder="请输入金额   " clearable input-align="right"  @input="totalMoney4" @clear="from.cityMoney = ''"/>
    </div>

    <div class="one">
      <van-field label="礼品、招待费用其他费用(须附报告)/(欧元)(Cadeau, hospitalité, autres dépenses (rapport requis))" type="number" v-model="from.other" placeholder="请输入金额   " clearable input-align="right" @input="totalMoney5" @clear="from.other = ''"/>
    </div>

    <div class="one">
      <van-field label="预算总额/(欧元)(Budget total)" v-model="from.total" placeholder="自动计算   " input-align="right" disabled/>
    </div>

     <div class="one" style="background:#fff;padding:10px 0">
      <div>
        <span style="margin-left:18px; padding-bottom:15px; font-size:18px">附件</span>
      </div>
      <van-uploader v-model="url" :before-read="asyncBeforeRead" accept="*" style="margin-left:18px; margin-top:10px" preview-size="60px"/>
    </div>

    <!-- 备注 -->
    <div style="background:#f6f6f6;color:#999; padding:0px 16px; padding-top:16px; margin-bottom:70px">
      <div>备注：</div>
      <div>1、职员阿国境内出差可自行购买机票。</div>
      <div>2、职员境外出差应提前5天将出差申请交至人力资源部，需办理第三国签证的，应提前1个月提出申请。</div>
      <div>3、职员出差，须详细填写人数、天数、事由、行程、航班号、起止时间地点等机票购买要求，职员姓名拼音需与护照一致。</div>
      <div>4、主办单位负责人审核职员出差必要性以及费用预算是否为工作需要。</div>
    </div>
    <div class="one">
      <span style="margin-left:18px; padding-bottom:15px; font-size:18px">审批</span>
    </div>
    <!-- 提交按钮 -->
    <div class="footer-container">
      <van-button type="info" style="width:100%;" @click="checkVal">提交</van-button>
    </div>
  </div>
</template>

<script>
import { fileUpload } from "@/api/login";
import {eurape_json} from '../mock.js'
import qs from 'qs'

export default {
  data(){
    return{
      personNum: 1, //出差同行人数
      url:[],
      columnsdata:[],
      deptName: JSON.parse(sessionStorage.getItem('deptID')),
      deptID: [],
      //校验
      rule:{
        organizers: false,
        contacts: false,
        reason: false,
        myDept: false,
        startDate: false,
        endDate: false,
        destination: false,
        arrive: false,
        takeoff: false,
      },
      flyclass: '',
      // 地址
      areaList: eurape_json,
      start: 0,
      end: 0,
      showDate: false,
      startDate1: new Date(),
      endDate1: new Date(),
      from: {
        memo:'0', //申请人传0 / 审批人传1 （前后端约定）
        Deptname:'',
        myDept: '',   //申请人所在部门
        userId: '',   //申请人userId
        organizers: '', //主办单位
        contactsName: '',//联系人及联系方式
        contacts:'', //联系人ID（传服务端）
        reason: '', //出差事由
        personID:[ 
          {
            name: '', //人名
          }
        ],
        person:[], //出差人ID
        startDate: '', //出差时间 开始时间
        endDate: '',  //出差时间 结束时间
        days: '',    //共计时长(天)
        flight:[{       //出差行程及航班
          destination: '',  //出差目的地
          goTime: '',    //行程日期
          filghtNumber: '', //航班号
          takeoff: '',  //起飞地
          arrive: '',  //到达地
          takeoffTime:'', //起飞时间
          arriveTime: '', //到达时间
        }],

        traffic: '',  //长途交通费用/(欧元)
        cityMoney: '',   //市政交通费用/(欧元)
        accommodation: 95, //住宿费用/(欧元)
        subsidy: 40,  //伙食费用/出差补助/(欧元)
        other: '', // 礼品、招待费用其他费用(须附报告)/(欧元)
        total: '',  //预算总额/(欧元)
        uploadFile: [], //上传附件 （图片、文件）
      },
      a: 0, //给数组数据赋值的左边
      showPicker: false,
       organizers: ['国内工作部', '劳务工作部(国内)', '人力资源部(国内)', '财务资金部(国内)', '采购中心'],
      arrivetime: false,
      flyaddreshow: false, //起飞地/到达地 弹窗显示
      goTimeshow: false, //出现日期
      showmyDept: false, //部门
    }
  },
  methods: {
    formateArray(dataList) {
      let poupData = [];
      dataList.forEach(ele => {
        let text = "", id = "";
        text = ele.deptName;
        id = ele.deptId;
        poupData.push({
          text: text,
          id: id
        });
      });
      return poupData;
    },
    // 部门弹窗数据获取
    Deptnameconfirm(value){
      this.from.myDept = value.id;
      this.from.Deptname = value.text;
      this.showmyDept = false;
      this.rule.myDept = false //校验红色恢复
    },
    openshowDept(){
      this.columnsdata = this.formateArray(this.deptName);
      this.showmyDept = true;
      let IDArr = sessionStorage.getItem('deptID');
    },
    
    //选择人员
    getDept(){
      dd.biz.contact.departmentsPicker({
        title:"选择人员",            //标题
        corpId:"xxx",              //企业的corpId
        multiple:true,            //是否多选
        limitTips:"超出了",          //超过限定人数返回提示
        maxDepartments:100,            //最大选择部门数量
        pickedDepartments:[],          //已选部门
        disabledDepartments:[],        //不可选部门
        requiredDepartments:[],        //必选部门（不可取消选中状态）
        appId:158,              //微应用的Id
        permissionType:"xxx",          //选人权限，目前只有GLOBAL这个参数
        onSuccess: function(result) {
            /**
            {
                userCount:1,                              //选择人数
                departmentsCount:1，//选择的部门数量
                departments:[{"id":,"name":"","number":}]//返回已选部门列表，列表中每个对象包含id（部门id）、name（部门名称）、number（部门人数）
            }
            */
        },
      onFail : function(err) {}
    });
    },
    //钉钉选择联系人
    contactsPerson(e, index){
      let that = this;
      this.$dd.biz.contact.complexPicker({
        title:"联系人",            //标题
        corpId: sessionStorage.getItem('corpId'),   //企业的corpId
        multiple:false,            //是否多选
        limitTips:"超出了",          //超过限定人数返回提示
        maxUsers:1,            //最大可选人数
        pickedUsers:[],            //已选用户
        pickedDepartments:[],          //已选部门
        disabledUsers:[],            //不可选用户
        disabledDepartments:[],        //不可选部门
        requiredUsers:[],            //必选用户（不可取消选中状态）
        requiredDepartments:[],        //必选部门（不可取消选中状态）
        appId:158,              //微应用的Id
        permissionType:"xxx",          //可添加权限校验，选人权限，目前只有GLOBAL这个参数
        responseUserOnly:false,        //返回人，或者返回人和部门
        startWithDepartmentId:0 ,   //仅支持0和-1
        onSuccess: function(result) {
          if(e=='contactsName'){
            that.from.contactsName = result.users[0].name;
            that.from.contacts = result.users[0].emplId;
            that.rule.contacts = false; //校验红色恢复
          } 
          if(e=='name'){
            that.from.personID[index].name = result.users[0].name;
            that.from.person.push(result.users[0].emplId);
            that.getPersonNum();
          } 
          /**
          {
              selectedCount:1, //选择人数
              users:[{"name":"","avatar":"","userid":""}]，//返回选人的列表，列表中的对象包含name（用户名），avatar（用户头像），emplId（用户工号）三个字段
              departments:[{"id":,"name":"","number":}]//返回已选部门列表，列表中每个对象包含id（部门id）、name（部门名称）、number（部门人数）
          }
          */
        },
      onFail : function(err) {}
    });
    },
    // 开始时间/结束时间
    startDateshow(name){
      this.flyclass = name;
      this.showDate = true;
    },
    endDateshow(name){
      this.flyclass = name;
      this.showDate = true;
    },
    hahah(){
      this.getMoney();
    },
    
   //计算住宿费 伙食费
    getMoney(){
      let sum = 0
      for (let i = 0; i < this.from.flight.length; i++) {
        sum += (this.from.flight[i].numday - 0);
      }
      let zhusu = this.from.accommodation = 95 * sum;
      let huoshi = this.from.subsidy = 40 * sum;
      let money = ((this.from.traffic - 0) + (this.from.cityMoney - 0) + (this.from.other - 0));
      let dairu = ((zhusu + huoshi - 0) * (this.personNum + 1 - 0));
      this.from.total = (dairu - 0) + (money - 0);
      //this.from.total = (money - 0) + ((zhusu + huoshi) * (this.personNum + 1));
      console.log('带入金额p:'+ money);
      console.log('随行人 '+ this.personNum);
      console.log('总人 '+ (this.personNum + 1));
      console.log("带入金额："+ ((zhusu + huoshi - 0) * (this.personNum + 1)));
      console.log('总额： '+ this.from.total);
    },
    //上传图片
      asyncBeforeRead(file) {
      return new Promise((resolve, reject) => {
        if (file.length >= 2) {
          this.$toast('每次只能上传一张图片');
          reject();
        } else {
          resolve();
          this.afterRead(file)
        }
      });
    },
    afterRead(file) {
      let formData = new FormData();
      formData.append("file", file);
      formData.append("userid", sessionStorage.getItem('userId'));
      formData.append("memo", '0');
      fileUpload(formData,{headers: { 'Content-Type': 'multipart/form-data' }}).then(res => {
        if(res.data.code == 0){
          this.imgURL.push(res.data.filePath);
        }else{
          this.$toast('上传附件失败！')
        }
      });
    },
    //计算金额
    totalMoney1(val){
      this.getMoney();
    },
    totalMoney2(val){
      this.getMoney();
    },

    totalMoney3(val){
      this.getMoney();
    },
     totalMoney4(val){
      this.getMoney();
    },
     totalMoney5(val){
      this.getMoney();
    },
     totalMoney6(val){
      this.getMoney();
    },
    // 数组坐标赋值
    daoTime(val, name){
      this.flyclass = name;
      this.arrivetime = true;
      this.a = val;
    },
    flyTime(val, name){
      this.flyclass = name;
      this.arrivetime = true;
      this.a = val;
    },
    flyaddre(val, name){
      this.flyclass = name;
      this.flyaddreshow = true;
      this.a = val;
    },
    showgot(val){
      this.goTimeshow = true;
      this.a = val;
    },
    
    onConfirm(value) {
      this.from.organizers = value;
      this.showPicker = false;
      this.rule.organizers = false;
    },
    checkVal(){
      if(this.from.personID.length == 1){
        this.SuubmitData();
      }else{
        let val = this.from.personID.some(res => res.name=='')
        if(val == true){
          this.$toast("出差事职员有空值");
          return;
        }else{
          this.SuubmitData();
        }
     }
    },
    //提交表单
    SuubmitData(){
    //校验判断提醒
    if(!this.from.myDept){
      this.rule.myDept = true;
      this.$toast("所在部门未选择");
      return;
    }
    if(!this.from.organizers){
      this.rule.organizers = true;
      this.$toast("主办单位未选择");
      return;
    }
    if(!this.from.contacts){
      this.rule.contacts = true;
      this.$toast("联系人未选择");
      return;
    }
    if(!this.from.reason){
      this.rule.reason = true;
      this.$toast("出差事由未填写");
      return;
    }
    if(!this.from.startDate){
      this.rule.startDate = true;
      this.$toast("开始时间未选择");
      return;
    }
    if(!this.from.endDate){
      this.rule.endDate = true;
      this.$toast("结束时间未选择");
      return;
    }
    for (let i = 0; i < this.from.flight.length; i++) {
      if(!this.from.flight[i].destination){
        this.rule.destination = true;
        this.$toast("出差目的地未选择"); return;
      }
      if(!this.from.flight[i].takeoff){
       this.rule.takeoff = true;
       this.$toast("起飞地未选择"); return;
      }
      if(!this.from.flight[i].arrive){
        this.rule.arrive = true;
        this.$toast("到达地未选择"); return;
      }
    }
    if( !this.from.organizers && !this.from.contacts && !this.from.reason){
      this.$toast("必填项未填写"); return;
    }else{
      //1、起飞时间 和 到达时间 其一没填 给出提示； 2、起飞时间 和 到达时间 （都未填写）不提示 （服务端要求）
      if(!this.from.flight[0].takeoffTime && !this.from.flight[0].arriveTime){

      }else{
        if(!this.from.flight[0].takeoffTime){
          this.$toast('请填写起飞时间');
          return;
        }
        if(!this.from.flight[0].arriveTime){
          this.$toast('请填写到达时间');
          return;
        }
      }
      
      this.from.subsidy = this.from.subsidy.toString();
      this.from.accommodation = this.from.accommodation.toString();
      this.from.total = this.from.total.toString();     //统计总金额转string
      this.from.userId = sessionStorage.getItem('userId');   //申请人userid
      this.from.uploadFile = this.imgURL;
      let dataJson = qs.stringify({
        json: JSON.stringify(this.from)
      });
      
      this.$http.post('/api/auth/sendThirdStateTripsToDingSpDatas', dataJson, {
        headers: { "Content-Type": "application/x-www-form-urlencoded" }
      }).then( res =>{
        if(res.data.code == 0){
          this.$dialog.alert({

            
            message: `${res.data.msg}`,
          }).then(() => {
            this.from = {
               personID:[ 
                {
                  name: '', //人名
                }
              ],
            };
            this.url = [];
          });
        }else{
           this.$dialog.alert({
            message: `${res.data.msg}`,
          }).then(() => {
          });
        }
      });
     }     
    },
    // 计算出差人数
    getPersonNum(){
      if(this.from.personID[0].name==''){
        this.personNum = 0;
      }else{
        this.personNum = this.from.personID.length;
      }
      // this.personNum = this.from.personID.length;
      console.log("随行人："+this.personNum);
      this.getMoney();
    },
    //添加出行人员
    addPerson(){
      setTimeout(res =>{
        this.getMoney();
      },1000);
      if(this.from.personID.length >= 8){
        this.$toast("最多添加8个同行人");
        return;
      }
      this.from.personID.push({
        name:'',
      })
    },
    delPerson(index){
      if(this.from.personID.length <= 1){
        this.$toast("最少要有一位出行人");
        return;
      }
      this.$dialog.confirm({
        title: '标题',
        message: `你确定要删除同行人明细${(index + 1)}吗？`,
        }).then(() => {
         this.from.personID.splice(index, 1);
         this.getPersonNum();
         setTimeout(res =>{
          this.getMoney();
         },1000);
        }).catch(() => {
        // on cancel
      });
     
    },

     //出差行程明细
    addFlight(){
      if(this.from.flight.length >= 15){
        this.$toast("最多添加3个同行人");
        return;
      }
      this.from.flight.push({
        id:'',
        name:'',
      })
    },
    delFlight(index){
      if(this.from.flight.length <= 1){
        this.$toast("最少要有一位出行人");
        return;
      }
      this.$dialog.confirm({
        title: '标题',
        message: `你确定要删除出差行程明细${(index + 1)}吗？`,
        }).then(() => {
          setTimeout(res =>{
            this.getMoney();
            this.hahah();
          },1000);
         this.from.flight.splice(index, 1);
        }).catch(() => {
        // on cancel
      });
     
    },
    //开始时间
    startConfirm(value){
      if(this.flyclass === 'start'){
        this.from.startDate = this.$moment(value).format("YYYY-MM-DD");
        if(this.from.startDate && this.from.endDate){
          var startDate = Date.parse(this.from.startDate.replace('/-/g','/'));
          var endDate = Date.parse(this.from.endDate.replace('/-/g','/'));
          var diffDate = (endDate-startDate)+1*24*60*60*1000;
          this.from.days = diffDate/(1*24*60*60*1000);
        }
        this.showDate = false;
        this.getMoney()
      }

      if(this.flyclass === 'end'){
        this.from.endDate = this.$moment(value).format("YYYY-MM-DD");
        if(this.from.startDate && this.from.endDate){
          var startDate = Date.parse(this.from.startDate.replace('/-/g','/'));
          var endDate = Date.parse(this.from.endDate.replace('/-/g','/'));
          var diffDate = (endDate-startDate)+1*24*60*60*1000;
          this.from.days = diffDate/(1*24*60*60*1000);
        }
       this.showDate = false;
       this.getMoney()
      }
      
    },
    // 起飞地/到达地
    flyaddreConfirm(value){
      if(this.flyclass == 'qifei'){
        this.from.flight[this.a].takeoff = value[1].name;
        this.flyaddreshow = false;
        this.getMoney();
      }

      if(this.flyclass == 'daoda'){
        this.from.flight[this.a].arrive = value[1].name;
        this.flyaddreshow = false;
        this.getMoney();
      }

      if(this.flyclass == 'ChuCaiMuDiDi'){
        this.getMoney();
        this.from.flight[this.a].destination = value[1].name;
        this.flyaddreshow = false;
        this.rule.destination = false
      }
      
    },
    goTimeConfirm(value){
      this.from.flight[this.a].goTime = this.$moment(value).format("YYYY-MM-DD");
      this.goTimeshow = false;
    },
    //起飞/到达时间弹窗
    arriveTimeConfirm(value){
      if(this.flyclass==='daodaTime'){
        this.from.flight[this.a].arriveTime = this.$moment(value).format("YYYY-MM-DD HH:mm");
        this.arrivetime = false;
      }
      if(this.flyclass==='qifeiTime'){
        this.from.flight[this.a].takeoffTime = this.$moment(value).format("YYYY-MM-DD HH:mm");
        this.arrivetime = false;
      }
      if(this.flyclass === 'goTime'){
        this.from.flight[this.a].goTime = this.$moment(value).format("YYYY-MM-DD");
        this.arrivetime = false;
      }
    }
  },
  created(){
    setTimeout(res=>{
      this.getPersonNum();
    },500)
  }
}
</script>
<style scoped >
  .form-container{
    width: 100%;
    height: 100%;
    padding-bottom: 300px;
  }
  .one {
    margin-top: 20px;
  }
  
  .footer-container {
    padding: 40px 30px 40px;
    background-color: #fff;
    position: fixed;
    width: 100%;
    left: 0;
    bottom: 0;
    z-index: 99;
  }
  .van-cell-group__title {
    font-size: 12px;
    padding: 15px 0;
    padding-left: 30px;
  }
  .add{
    height:70px;
    color: #1989FA;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .person_title{
    display: flex;
    justify-content: space-between;
    color: #999;
  }
  .font_class{
    font-size: 20px !important;
  }
  .sd{
    display: flex;
    justify-content:space-between;
    align-items: center;
    background: #fff;
    height:100px;
    margin: 1px 0;
  }
</style>